package com.niit.servlet;

import com.niit.domain.Notice;
import com.niit.service.INoticeService;
import com.niit.service.impl.NoticeServiceImpl;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;

@WebServlet(name = "NoticeServlet", value = "/NoticeServlet")
public class NoticeServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        INoticeService ins=new NoticeServiceImpl();
        //Notice公告
        Notice notice= ins.queryNoticeService();
        //将数据放在session中
        System.out.println(notice);
        HttpSession notSession=request.getSession();
        notSession.setAttribute("notice",notice);
        response.sendRedirect("index.jsp");
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
